<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"
	 import="util.Translator"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<% //Language management
	Translator t = new Translator();
	String lang = request.getParameter("lang");
	Cookie c = null;

	Cookie [] cookies = request.getCookies();
	if (cookies != null)
		for (Cookie i : cookies)
			if (i.getName().equals("vlang")) {
				c = i;
				break;
			}
	
	if (c == null)
		c = new Cookie("vlang", "en");
			
   if (lang != null) {
	   t.setLanguage(lang);
	   c.setValue(lang);
	}
	else
		t.setLanguage(c.getValue());
 
   response.addCookie(c);
%>

<html>
   <head>
      <link rel="stylesheet" type="text/css" href="css/regStyle.css">
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      <title><%=t.translate("Registrarse")%></title>
   </head>

   <body>
      <table class="mainTable">
         <tr>
            <td>
               <a href=home.jsp><img width="100px" height="50px" src="img/logo.jpg" /></a>
            </td>
         </tr>
         
         <tr> <td><hr color="#ffa200" width="100%" size="3px"/></td> </tr>
         
         <tr>
            <td>
	            <form action="Register" method="post">
	               <table class="formTable">
	                  <tr>
	                     <td> <%=t.translate("Nombre")%> </td>
	                     <td> <input type="text" name="name"></input> </td>
	                  </tr>
	                  <tr>
	                     <td> <%=t.translate("Usuario")%> </td>
	                     <td> <input type="text" name="nickname"> </td>
	                  </tr>
	                  <tr>
	                     <td> <%=t.translate("Correo")%> </td>
	                     <td> <input type="text" name="mail"> </td>
	                  </tr>
	                  <tr>
	                     <td> <%=t.translate("Edad")%> </td>
	                     <td> 
	                        <select name="age">
	                           <% for (int i=18; i < 99; i++) { %>
	                              <option value=<%=i%>> <%=i%> </option>
	                           <%}%>
	                        </select>       
	                     </td>
	                  </tr>
	                  <tr>
	                     <td> <%=t.translate("Contrase&ntilde;a")%> </td>
	                     <td> <input type="password" name="pass1"/> </td>
	                     <td> <%=t.translate("Confirmar")%> </td>
	                     <td> <input type="password" name="pass2"/> </td>
	                  </tr>
	                  <tr>
	                     <th colspan="4" class="centerButton">
	                        <input type="submit" value=<%=t.translate("Enviar")%>>
	                     </th>
	                  </tr>
	               </table>
				</form>
            </td>
         </tr>
      </table>
   </body>
   
</html>